<template>
  <div class="wrap">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="人员管理" name="first">
        <People v-if="flag" />
      </el-tab-pane>
      <el-tab-pane label="角色管理" name="second">
        <Roles v-if="!flag" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import People from './people'
import Roles from  './roles'
export default {
  components: {
    People,
    Roles
  },
  data() {
    return {
      activeName: 'first',
      flag: true
    }
  },
  mounted() {
    
  },
  methods: {
    handleClick(val) {
      if (val.name === 'second') {
        this.flag = false
      } else {
        this.flag = true
      }
    }
  }
}
</script>

<style lang="less" scoped>
  .wrap {
    padding: 0 20px;
    width: calc(100% - 40px);
    background-color: #ffffff;
  }
</style>